<template>
    <div>
        <div class="container">
            <h4>{{info.title}}</h4>
            <span >{{info.add_time | datefmt('YYYY-MM-DD HH:mm:ss')}}  {{info.click}}次浏览</span>
            <p class="line"></p>
            <div class='content' v-html="info.content"></div>       
	    </div>
        <comment :id='id'></comment>
    </div>
	
</template>

<script>
    import { Toast } from 'mint-ui';
    import comment from '../subcom/comment.vue';//导入评论组件
    export default{
        components:{
            comment
        },
        data(){
            return {
                id:0,
                info:{}
            }
        },
        created(){
            this.id=this.$route.params.id;
            this.getNewsInfo();
        },
        methods:{
            getNewsInfo(){
                var url="api/getnew/"+this.id;
                this.$http.get(url).then(function(res){
                    if(res.body.status!=0){
                        Toast(res.body.message);
                        return;
                    }
                    console.log(res.body.message);
                    this.info=res.body.message[0];
               
                })
            }
        }
        
    }

</script>

<style scoped>
    .container {
        padding:5px;
    }
    .container span {
        color:rgba(0,0,0,.5);
        padding:5px 0;
        font-size:14px;
    }
    .line {
        margin-top:5px;
        height:1px;
        border-bottom:2px solid #ccc;
    }
</style>